package com.xm.settlement.service.impl;

import com.baomidou.framework.service.impl.SuperServiceImpl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.xm.settlement.commons.utils.PageInfo;
import com.xm.settlement.mapper.AppBaseMapper;
import com.xm.settlement.model.AppBase;
import com.xm.settlement.service.IAppBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/2/16.
 */
@Service
public class AppBaseServiceImpl extends SuperServiceImpl<AppBaseMapper,AppBase> implements IAppBaseService {

    @Autowired
    private AppBaseMapper appBaseMapper;


    @Override
    public void selectDataGrid(PageInfo pageInfo) {
        Page<AppBase> page = new Page<AppBase>(pageInfo.getNowpage(), pageInfo.getSize());
        List<AppBase> list = appBaseMapper.selectAppBaseList(page);
        pageInfo.setRows(list);
        pageInfo.setTotal(page.getTotal());
    }

    @Override
    public List<AppBase> selectListByObject(AppBase appBase) {
        EntityWrapper<AppBase> wrapper = new EntityWrapper<AppBase>(appBase);
        if (null != appBase.getId()) {
            wrapper.and("id = {0}", appBase.getId());
        }
         return  this.selectList(wrapper);
    }

}
